
// Copyright (C) 1995. All rights reserved.
// Use is governed by the MiscKit license

#import "TimeShow.h"

@implementation TimeShow

- init
{
	[super init];
	rate = 1;
	UDState = UP;
	return self;
}

- chDay:sender
{
	if(UDState==UP)
		[self addDays:rate];
	else
		[self subtractDays:rate];
	[self show:self];
	return self;
}

- chHour:sender
{
	if(UDState==UP)
		[self addHours:rate];
	else
		[self subtractHours:rate];
	[self show:self];
	return self;
}

- chMin:sender
{
	if(UDState==UP)
		[self addMinutes:rate];
	else
		[self subtractMinutes:rate];
	[self show:self];
	return self;
}

- chMonth:sender
{
	if(UDState==UP)
		[self addMonths:rate];
	else
		[self subtractMonths:rate];
	[self show:self];
	return self;
}

- chSec:sender
{
	if(UDState==UP)
		[self addSeconds:rate];
	else
		[self subtractSeconds:rate];
	[self show:self];
	return self;
}

- chToUpState:sender
{
	UDState = UP;
	return self;
}

- chToDownState:sender
{
	UDState = DOWN;
	return self;
}

- chUSec:sender
{
	if(UDState==UP)
		[self addMicroSeconds:rate];
	else
		[self subtractMicroSeconds:rate];
	[self show:self];
	return self;
}

- chWeek:sender
{
	if(UDState==UP)
		[self addWeeks:rate];
	else
		[self subtractWeeks:rate];
	[self show:self];
	return self;
}

- chYear:sender
{
	if(UDState==UP)
		[self addYears:rate];
	else
		[self subtractYears:rate];
	[self show:self];
	return self;
}

- setRate:sender
{
	[inputField selectText:self];
	rate = [inputField intValue];
	return self;
}

- show:sender
{
	[outputField setStringValue:[self timeString]];
	return self;
}

- zeroIt:sender
{
	[self init];
	[self setTime_t:0];
	[self show:self];
	return self;
}


@end
